
function checkUserName (name) {
  let pattern = /^[a-zA-Z0-9]{1}([a-zA-Z0-9]|[._-]){3,99}$/
  return pattern.test(name)
}

export default {
  checkUserName,
  userNameValidator (rule, value, callback) {
    if (checkUserName(value)) {
      callback()
    } else {
      callback(new Error('用户名只能是 数字,字母, ._-'))
    }
  }
}
